package com.cx.common;


public class ServiceException extends RuntimeException {
    private static final long serialVersionUID = -8336393496063368116L;

    private String msg;

    private Integer code;

    public ServiceException(Integer code, String msg) {
        super();
        this.msg = msg;
        this.code = code;
    }

    public ServiceException(String msg) {
        this(ResultCode.SYSTEM_INNER_ERROR.code(), msg);
    }

    public ServiceException(IResultCode resultCode) {
        this(resultCode.code(), resultCode.msg());
    }

    @Override
    public String getMessage() {
        return msg;
    }

    /**
     * @return code
     */
    public Integer getCode() {
        return code;
    }

}